home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gwu / template.c < prev    next >
C/C++ Source or Header  |  1996-01-30  |  4KB  |  161 lines

  1. /*
  2.     GWAda Development Environment for 386/486 PCs   
  3.     Copyright (C) 1993, Arthur Vargas Lopes  & Michael Bliss Feldman
  4.                         vlopes@vortex.ufrgs.br mfeldman@seas.gwu.edu
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; version 2 of the License.    
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20. /* template.c */
  21.  
  22. #include <externs.h>
  23.  
  24. void AVL_MOUNT_TEMPLATE(char *local)
  25. {
  26.     AVL_EDIT_WINDOW_PTR w;
  27.     AVL_LINE_PTR temp, head = NULL;
  28.     AVL_WIN_PTR m1;
  29.     char fname[100];
  30.     int n1, n2, x;
  31.     char msg2[80];
  32.     char *pl;
  33.     pl = getenv("ADAED");
  34.     if (pl == NULL)
  35.         pl=getenv("adaed");
  36.     if (pl != NULL)  
  37.         sprintf(fname,"%s%c%s",pl,'\\',local);
  38.     else  {
  39.         AVL_ERROR("Set the ADAED environment variable first (see readme.gw).");
  40.         return;
  41.         }        
  42.  
  43.     w = &avl_windows[avl_window];
  44.     n1 = w -> txt_col;
  45.     avl_start_pos = AVL_COL() - 1;
  46.     if (avl_start_pos < 0) avl_start_pos = 0;
  47.     w -> txt_col = 0;
  48.     temp = AVL_MAKE_LINE("### DUMMY ###",0);
  49.     AVL_LINE_INSERT(temp,&head);
  50.     x = AVL_LOAD(fname, &head);
  51.     avl_start_pos = 0;
  52.  
  53.     if (!x) {
  54.         sprintf(msg2,"Can't open \'%s\'", fname);
  55.         AVL_ERROR(msg2);
  56.         w -> txt_col = n1;
  57.         }
  58.     else {
  59.         AVL_CLEAR_BLOCK();
  60.         avl_block_first_line = head -> next;
  61.         avl_block_last_line = head -> previous;
  62.         avl_block_first_col = 0;
  63.         avl_block_last_col = strlen(head -> previous -> line) - 1;
  64.         if (avl_block_last_col < 0) avl_block_last_col = 0;
  65.         AVL_EDIT_COPY(1);
  66.         AVL_CLEAR_BLOCK();
  67.         AVL_FIND(1,"$");
  68.         AVL_EDIT_DEL_RIGHT(1);
  69.         }
  70. }
  71.  
  72. void AVL_TEMPLATE_ADA_PGM()
  73. {
  74.     AVL_MOUNT_TEMPLATE("adapgm.tpl");
  75.     strcpy(avl_message,"Enter the program's name");
  76. }
  77.     
  78. void AVL_TEMPLATE_ADA_VECTOR()
  79. {
  80.     AVL_MOUNT_TEMPLATE("adavecto.tpl");
  81.     strcpy(avl_message,"Enter the vector's name (type)");
  82. }
  83.     
  84. void AVL_TEMPLATE_ADA_ACCESS()
  85. {
  86.     AVL_MOUNT_TEMPLATE("adaacces.tpl");
  87.     strcpy(avl_message,"Enter the pointer's name (type)");
  88. }
  89.     
  90. void AVL_TEMPLATE_ADA_RECORD()
  91. {
  92.     AVL_MOUNT_TEMPLATE("adarecor.tpl");
  93.     strcpy(avl_message,"Enter the record's name (type)");
  94. }
  95.     
  96. void AVL_TEMPLATE_ADA_MATRIX()
  97. {
  98.     AVL_MOUNT_TEMPLATE("adamatri.tpl");
  99.     strcpy(avl_message,"Enter the matrix's name (type)");
  100. }
  101.     
  102. void AVL_TEMPLATE_ADA_TASK()
  103. {
  104.     AVL_MOUNT_TEMPLATE("adatask.tpl");
  105.     strcpy(avl_message,"Enter the task's name");
  106. }
  107.     
  108. void AVL_TEMPLATE_ADA_PACKAGE()
  109. {
  110.     AVL_MOUNT_TEMPLATE("adapacka.tpl");
  111.     strcpy(avl_message,"Enter the package's name");
  112. }
  113.     
  114. void AVL_TEMPLATE_ADA_GENERIC()
  115. {
  116.     AVL_MOUNT_TEMPLATE("adagener.tpl");
  117.     strcpy(avl_message,"Enter the stack's name (type)");
  118. }
  119.     
  120. void AVL_TEMPLATE_ADA_SERVER()
  121. {
  122.     AVL_MOUNT_TEMPLATE("adaserve.tpl");
  123.     strcpy(avl_message,"Enter the entry's name (type)");
  124. }
  125.     
  126. void AVL_TEMPLATE_ADA_LOOP()
  127. {
  128.     AVL_MOUNT_TEMPLATE("adaloop.tpl");
  129.     strcpy(avl_message,"Enter the loop's range");
  130. }
  131.     
  132. void AVL_TEMPLATE_ADA_WHILE()
  133. {
  134.     AVL_MOUNT_TEMPLATE("adawhile.tpl");
  135.     strcpy(avl_message,"Enter the while condition");
  136. }
  137.     
  138. void AVL_TEMPLATE_ADA_IF()
  139. {
  140.     AVL_MOUNT_TEMPLATE("adaif.tpl");
  141.     strcpy(avl_message,"Enter the condition");
  142. }
  143.     
  144. void AVL_TEMPLATE_ADA_CASE()
  145. {
  146.     AVL_MOUNT_TEMPLATE("adacase.tpl");
  147.     strcpy(avl_message,"Enter the case's object");
  148. }
  149.     
  150. void AVL_TEMPLATE_ADA_FUNCTION()
  151. {
  152.     AVL_MOUNT_TEMPLATE("adafunct.tpl");
  153.     strcpy(avl_message,"Enter the function's name");
  154. }
  155.     
  156. void AVL_TEMPLATE_ADA_PROCEDURE()
  157. {
  158.     AVL_MOUNT_TEMPLATE("adaproce.tpl");
  159.     strcpy(avl_message,"Enter the procedure's name");
  160. }
  161.